package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread qwe = new Thread("张三"){
            public void run(){
                for (int i=0;i<5;i++){
                    try {
                        System.out.println(getName()+":你跳啊,你跳我就跳");
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("扑通~啊~啊~啊~啊~~~");
            }
        };
        Thread asd = new Thread("李四"){
            public void run(){
                while (true){
                    System.out.println(getName()+":你当我傻吗,你先跳");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        qwe.start();
        asd.setDaemon(true);
        asd.start();

        //while (true);
    }
}
